const express = require('express');
const router = express.Router();
const { createReview, getCarReviews, getUserReviews, getReviewDetails } = require('../controllers/reviewController');
const { createReview: createReviewValidation } = require('../middleware/validator/reviewValidator');
const { validateRequest } = require('../middleware/validator');
const { verifyToken } = require('../utils/jwt');

// 创建评价
router.post('/', verifyToken(), createReviewValidation, validateRequest, createReview);

// 获取车辆的所有评价
router.get('/car/:carId', getCarReviews);

// 获取用户的所有评价
router.get('/user', verifyToken(), getUserReviews);

// 获取用户单条评价详情
router.get('/:id', verifyToken(), getReviewDetails);

module.exports = router; 